﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="list.aspx.cs" Inherits="orgman_models_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../style/StyleSheet.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #model
        {
            text-align: center;
        }
        #modimodel
        {
            text-align: center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="main">
        <div id="content">
        <div id="model">
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:appConnectionString %>" 
                
                SelectCommand="SELECT [modelname], [modelid], [creator] FROM [model] WHERE ([organizationid] = @organizationid) ORDER BY [modelid] DESC">
                <SelectParameters>
                    <asp:SessionParameter Name="organizationid" SessionField="organizationid" 
                        Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" DataKeyNames="modelid" 
                DataSourceID="SqlDataSource2" 
                Width="700px" CssClass="dataTable">
                <Columns>
                    <asp:BoundField DataField="modelname" HeaderText="模型名称" 
                        SortExpression="modelname" />
                    <asp:BoundField DataField="creator" HeaderText="创建者" SortExpression="creator" />
                    <asp:CommandField SelectText="浏览具体"  ItemStyle-CssClass="bacimg1"
                        ShowSelectButton="True" SelectImageUrl="~/images/detail.gif" >
<ItemStyle CssClass="bacimg1"></ItemStyle>
                    </asp:CommandField>
                </Columns>
                <EmptyDataTemplate>
                    <asp:Label ID="Label1" runat="server" Text="您的组织当前还没有任何评估模型。"></asp:Label>
                </EmptyDataTemplate>
            </asp:GridView>
            </div>
            <hr style="color: #3399FF" />
            <div id="modimodel">
            
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:appConnectionString %>" 
                SelectCommand="SELECT * FROM [model] WHERE ([modelid] = @modelid)" 
                DeleteCommand="DELETE FROM [model] WHERE [modelid] = @modelid" 
                InsertCommand="INSERT INTO [model] ([modelname], [creator], [createdtime], [target], [description], [available]) VALUES (@modelname, @creator, @createdtime, @target, @description, @available)" 
                UpdateCommand="UPDATE [model] SET [modelname] = @modelname, [target] = @target, [description] = @description WHERE [modelid] = @modelid">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="modelid" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="modelid" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="modelname" Type="String" />
                    <asp:Parameter Name="creator" Type="String" />
                    <asp:Parameter Name="createdtime" Type="DateTime" />
                    <asp:Parameter Name="target" Type="String" />
                    <asp:Parameter Name="description" Type="String" />
                    <asp:Parameter Name="available" Type="String" />
                    <asp:Parameter Name="modelid" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="modelname" Type="String" />
                    <asp:Parameter Name="creator" Type="String" />
                    <asp:Parameter Name="createdtime" Type="DateTime" />
                    <asp:Parameter Name="target" Type="String" />
                    <asp:Parameter Name="description" Type="String" />
                    <asp:Parameter Name="available" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>
            
                <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="700px" 
                    AutoGenerateRows="False" BackColor="White" CellPadding="4" DataKeyNames="modelid" 
                    DataSourceID="SqlDataSource1" CssClass="dataTable">
                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                    <RowStyle BackColor="White" ForeColor="#003399" />
                    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                    <Fields>
                        <asp:BoundField DataField="modelid" HeaderText="模型ID" InsertVisible="False" 
                            ReadOnly="True" SortExpression="modelid" Visible="False" />
                        <asp:BoundField DataField="modelname" HeaderText="模型名称" 
                            SortExpression="modelname" />
                        <asp:BoundField DataField="creator" HeaderText="创建者" ReadOnly="True" 
                            SortExpression="creator" />
                        <asp:BoundField DataField="createdtime" HeaderText="创建时间" ReadOnly="True" 
                            SortExpression="createdtime" />
                        <asp:BoundField DataField="target" HeaderText="目标（层）" SortExpression="target" />
                        <asp:BoundField DataField="description" HeaderText="备注" 
                            SortExpression="description" />
                        <asp:BoundField DataField="available" HeaderText="是否完成" ReadOnly="True" 
                            SortExpression="available" DataFormatString="{0}（true为完成，false为未完成）" />
                        <asp:CommandField EditText="&lt;img src='../../images/modify.gif' alt='编辑' class='imgborder' /&gt;" 
                            ShowEditButton="True" HeaderText="修改模型信息" ShowHeader="True" 
                            Visible="False" />
                        <asp:HyperLinkField DataNavigateUrlFields="modelid" 
                            DataNavigateUrlFormatString="delete.aspx?id={0}" 
                            
                            Text="&lt;img src='../../images/delete.gif' alt='删除' class='imgborder' /&gt;" 
                            HeaderText="删除模型" Visible="False" />
                        <asp:HyperLinkField DataNavigateUrlFields="modelid" 
                            DataNavigateUrlFormatString="addrule.aspx?modelid={0}" 
                            Text="&lt;img src='../../images/101.png' alt='添加' /&gt;模型准则" 
                            HeaderText="为模型添加准则" Visible="False" />
                        <asp:HyperLinkField DataNavigateUrlFields="modelid" 
                            DataNavigateUrlFormatString="~/orgman/models/modelinfo.aspx?modelid={0}" 
                            HeaderImageUrl="~/images/detail.gif" HeaderText="预览模型" InsertVisible="False" 
                            Text="预览模型概况" />
                    </Fields>
                    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                    <EditRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                </asp:DetailsView>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
